<template>
  <xh-container hideBottomBar title="检验详情">
    <view>
      <view v-if="detailData">
        <view style="height: 10px"></view>
        <xh-desc-item label="裁片编号">{{
          detailData.cuttingCode
        }}</xh-desc-item>
        <xh-desc-item label="绣花厂">{{
          detailData.embroideryFactory
        }}</xh-desc-item>
        <xh-desc-item label="产品名称">{{
          detailData.productName
        }}</xh-desc-item>
        <xh-desc-item label="创建时间">{{
          detailData.createTime
        }}</xh-desc-item>
        <xh-desc-item label="创建人">{{ detailData.createBy }}</xh-desc-item>
        <xh-desc-item label="更新时间">{{
          detailData.updateTime
        }}</xh-desc-item>
        <xh-desc-item label="更新人">{{ detailData.updateBy }}</xh-desc-item>
        <uni-card
          :is-shadow="false"
          :key="index"
          v-for="(item, index) in detailData.itemList"
        >
          <uni-row class="demo-uni-row">
            <uni-col :span="12">
              <text>不良项目：{{ item.badItem }}</text>
            </uni-col>
            <uni-col :span="12">
              <text>项目描述：{{ item.itemDesc }}</text>
            </uni-col>
            <uni-col :span="12">
              <text>状态：{{ item.itemStatus }}</text>
            </uni-col>
            <uni-col :span="12">
              <text>数量：{{ item.itemNumber }}</text>
            </uni-col>
            <uni-col :span="24">
              <text>图片：</text>
              <xh-image :src="item.imagePath" preview />
            </uni-col>
          </uni-row>
        </uni-card>
      </view>
      <view v-else class="empty-text">暂无数据</view>
    </view>
  </xh-container>
</template>
<script>
import { getEmbroideryInspectInfo } from "@/api/purchase/pickplanbill.js";
export default {
  data() {
    return {
      detailData: null,
    };
  },
  onLoad(options) {
    const { embroideryId } = options;
    this.fetchDetail(embroideryId);
  },
  methods: {
    fetchDetail(embroideryId) {
      if (embroideryId) {
        getEmbroideryInspectInfo(embroideryId).then((res) => {
          const { data } = res;
          this.detailData = data;
        });
      }
    },
  },
};
</script>
<style lang="scss" scoped>
.empty-text {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 500px;
}
.img-wrapper {
  width: 50px;
  height: 40px;
}
</style>
